<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="author" content="Kodinger">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>My Login Page</title>
    <link rel="stylesheet" href="../static/css/bootstrap.min.css"
          integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
        <link href="../static/css/bootstrap.min.css" type='text/css' rel="stylesheet">
    <link href="../static/css/dashboard.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="../static/css/my-login.css">
</head>
<script src="../static/js/jquery.min.js" type="text/javascript" charset='utf-8'></script>

<script type="text/javascript">
    // 初始化界面
    $(function () {

        $("#reg_submit").click(function () {
            const email = $("#email").val();
            const password = $("#password").val();

            console.log(email);
            console.log(password);

            if ((email === undefined) || (password === undefined) || (email === '') || (password === '')) {
                alert('邮箱或密码不能为空！');
                return
            }

            $.get('http://127.0.0.1:5000/register/' + email + '/' + password, {},
                function (data) {
                    alert(data['info'])
					window.location.href = "login_page"
                }
            );
        });

    });
</script>


<body class="my-login-page">
	<section class="h-100">
		<div class="container h-100">
			<div class="row justify-content-md-center h-100">
				<div class="card-wrapper">
					<div class="brand">
						<img src="../static/img/user_logo.jpg" alt="bootstrap 4 login page">
					</div>
					<div class="card fat">
						<div class="card-body">
							<h4 class="card-title">注册</h4>
							<div class="my-login-validation" novalidate="">
								<div class="form-group">
									<label for="email">邮箱</label>
									<input id="email" type="email" class="form-control" name="email" required>
								</div>

								<div class="form-group">
									<label for="password">密码</label>
									<input id="password" type="password" class="form-control" name="password" required data-eye>
								</div>

<!--								<div class="form-group">-->
<!--									<div class="custom-checkbox custom-control">-->
<!--										<input type="checkbox" name="agree" id="agree" class="custom-control-input" required="">-->
<!--										<label for="agree" class="custom-control-label">同意 <a href="#">相关条款</a></label>-->
<!--										<div class="invalid-feedback">-->
<!--											You must agree with our Terms and Conditions-->
<!--										</div>-->
<!--									</div>-->
<!--								</div>-->

								<div class="form-group m-0">
									<button type="submit" class="btn btn-primary btn-block" id="reg_submit">
										注册
									</button>
								</div>
								<div class="mt-4 text-center">
									已有账号? <a href="login_page">登录</a>
								</div>
							</div>
						</div>
					</div>
					<div class="footer">
<!--						Copyright &copy; 2017 &mdash; Your Company -->
					</div>
				</div>
			</div>
		</div>
	</section>

<script src="../static/js/bootstrap.min.js"
        integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
        crossorigin="anonymous"></script>
<script src="../static/js/my-login.js"></script>
<script src="../static/js/jquery.min.js" type="text/javascript" charset='utf-8'></script>
<script src="../static/js/bootstrap.min.js" type="text/javascript"></script>
</body>
</html>
